package com.luban;

import com.luban.processor.TestBeanFactoryPostProcessor;
import com.luban.processor.TestRegisterPostProcessor;
import com.luban.service.AService;
import com.luban.service.BService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@EnableAspectJAutoProxy
public class Test {
	public static void main(String[] args) {

		AnnotationConfigApplicationContext context =
				new AnnotationConfigApplicationContext(AppConfig.class);
//		context.addBeanFactoryPostProcessor(new BeanDefinitionRegistryPostProcessor() {
//			@Override
//			public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
//				System.out.println("XXXXXXXX");
//			}
//
//			@Override
//			public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
//				System.out.println("OOOOOOOOO");
//			}
//		});
		context.addBeanFactoryPostProcessor(new TestRegisterPostProcessor());
		AService aService = context.getBean("AService", AService.class);
		BService bService = context.getBean("BService", BService.class);
		System.out.println("end----");
	}

	private void test(){
		ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext();
	}
}
